#include "EditToolFactory.h"
#include "ToolCreateLine.h"
#include "ToolSelect.h"
#include "ToolZoom.h"

EditToolFactory::EditToolFactory()
{
}

vector<int>
EditToolFactory::availableTools() const
{
    vector<int> result = { 0, 1, 2, 3, 4, 5, 6 };
    return result;
}

ToolBase *
EditToolFactory::createTool(int toolId)
{
    ToolBase * result = nullptr;
    switch(toolId)
    {
    case 0: result = new ToolSelect(":/images/tool_arrow.png"); break;
    case 1: result = new ToolZoom(":/images/tool_zoom.png"); break;
    case 2: result = new ToolCreateLine(":/images/tool_segment.png"); break;
    }
    m_tools.insert(std::make_pair(toolId, result));

    return result;
}

ToolBase *
EditToolFactory::tool(int toolId)
{
    return m_tools[toolId];
}


